package beans;

import java.math.BigDecimal;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "log_pay")
public class LogPay {
	private int id;// 日志id
	private Timestamp time;// 操作时间
	private Admin admin;// 操作人（外键）
	private Courier courier;// 操作人（外键）
	private Agent agent;// 操作人（外键）
	private Express express;// 充值网点（外键）
	private BigDecimal money;// 充值金额
	private BigDecimal give;// 赠送金额
	private int channel;// 充值渠道 1.后台充值 0.支付宝直冲
	private String serialNum;// 流水号
	private String comment;// 备注
	private String status;// 交易状态 wait:待付款 success:支付成功 fail:支付失败

	/**
	 * 构造充值日志
	 * 
	 * @param time
	 * @param admin
	 * @param express
	 * @param money
	 * @param channel
	 * @param serialNum
	 * @param comment
	 * @param status
	 */
	public LogPay(Timestamp time, Admin admin, Express express,
			BigDecimal money, BigDecimal give, int channel, String serialNum,
			String comment, String status) {
		super();
		this.time = time;
		this.admin = admin;
		this.express = express;
		this.money = money;
		this.give = give;
		this.channel = channel;
		this.serialNum = serialNum;
		this.comment = comment;
		this.status = status;
	}

	public LogPay(Timestamp time, Courier courier, Express express,
			BigDecimal money, BigDecimal give, int channel, String serialNum,
			String comment, String status) {
		super();
		this.time = time;
		this.courier = courier;
		this.express = express;
		this.money = money;
		this.give = give;
		this.channel = channel;
		this.serialNum = serialNum;
		this.comment = comment;
		this.status = status;
	}

	public LogPay(Timestamp time, Agent agent, Express express,
			BigDecimal money, BigDecimal give, int channel, String serialNum,
			String comment, String status) {
		super();
		this.time = time;
		this.agent = agent;
		this.express = express;
		this.money = money;
		this.give = give;
		this.channel = channel;
		this.serialNum = serialNum;
		this.comment = comment;
		this.status = status;
	}

	public LogPay() {
		super();
	}

	@GenericGenerator(name = "generator", strategy = "native")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "log_pay_id", unique = true, nullable = false)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "log_pay_time")
	public Timestamp getTime() {
		return time;
	}

	public void setTime(Timestamp time) {
		this.time = time;
	}

	@ManyToOne
	@JoinColumn(name = "log_pay_adminID")
	public Admin getAdmin() {
		return admin;
	}

	public void setAdmin(Admin admin) {
		this.admin = admin;
	}

	@ManyToOne
	@JoinColumn(name = "log_pay_courierID")
	public Courier getCourier() {
		return courier;
	}

	public void setCourier(Courier courier) {
		this.courier = courier;
	}

	@ManyToOne
	@JoinColumn(name = "log_pay_expBranchID")
	public Express getExpress() {
		return express;
	}

	public void setExpress(Express express) {
		this.express = express;
	}

	@Column(name = "log_pay_money")
	public BigDecimal getMoney() {
		return money;
	}

	public void setMoney(BigDecimal money) {
		this.money = money;
	}

	@Column(name = "log_pay_channel")
	public int getChannel() {
		return channel;
	}

	public void setChannel(int channel) {
		this.channel = channel;
	}

	@Column(name = "log_pay_comment")
	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	@Column(name = "log_pay_serialNum")
	public String getSerialNum() {
		return serialNum;
	}

	public void setSerialNum(String serialNum) {
		this.serialNum = serialNum;
	}

	@Column(name = "log_pay_status")
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = "log_pay_give")
	public BigDecimal getGive() {
		return give;
	}

	public void setGive(BigDecimal give) {
		this.give = give;
	}

	@ManyToOne
	@JoinColumn(name = "log_pay_agentID")
	public Agent getAgent() {
		return agent;
	}

	public void setAgent(Agent agent) {
		this.agent = agent;
	}

}
